package com.example.tests;

public class ContactData implements Comparable<ContactData>{
	
	public String firstName;
	public String lastName;
	public String firstAddress;
	public String homePhone;
	public String mobilePhone;
	public String workPhone;
	public String firstEmail;
	public String secondEmail;
	public String bDay;
	public String bMonth;
	public String bYear;
	public String groupLinkage;
	public String secondAddress;
	public String secondPhone;
	
	public ContactData() {
	}
	
	public ContactData(String contact_fname, String contact_lname,
			String contact_address, String contact_home_phone,
			String contact_mobile, String contact_work, String contact_email,
			String contact_email2, String contact_bday, String contact_bmonth,
			String contact_byear, String contact_group_linkage,
			String contact_address2, String contact_phone2) {
		this.firstName = contact_fname;
		this.lastName = contact_lname;
		this.firstAddress = contact_address;
		this.homePhone = contact_home_phone;
		this.mobilePhone = contact_mobile;
		this.workPhone = contact_work;
		this.firstEmail = contact_email;
		this.secondEmail = contact_email2;
		this.bDay = contact_bday;
		this.bMonth = contact_bmonth;
		this.bYear = contact_byear;
		this.groupLinkage = contact_group_linkage;	
		this.secondAddress = contact_address2;
		this.secondPhone = contact_phone2;
	}



	@Override
	public String toString() {
		return "ContactData [firstName=" + firstName + ", lastName=" + lastName
				+ ", firstAddress=" + firstAddress + ", homePhone=" + homePhone
				+ ", mobilePhone=" + mobilePhone + ", workPhone=" + workPhone
				+ ", firstEmail=" + firstEmail + ", secondEmail=" + secondEmail
				+ ", bDay=" + bDay + ", bMonth=" + bMonth + ", bYear=" + bYear
				+ ", groupLinkage=" + groupLinkage + ", secondAddress="
				+ secondAddress + ", secondPhone=" + secondPhone + "]";
	}

	@Override
	public int hashCode() {
		//final int prime = 31;
		int result = 1;
		//result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
		//result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		return true;
	}

	@Override
	public int compareTo(ContactData other) {	
		return this.lastName.toLowerCase().compareTo(other.lastName.toLowerCase());
	}

	public ContactData withFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactData withLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}

	public ContactData withFirstAddress(String firstAddress) {
		this.firstAddress = firstAddress;
		return this;
	}	
	
	public ContactData withHomePhone(String homePhone) {
		this.homePhone = homePhone;
		return this;
	}
	public ContactData withMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
		return this;
	}
	public ContactData withWorkPhone(String workPhone) {
		this.workPhone = workPhone;
		return this;
	}
	
	public ContactData withFirstEmail(String firstEmail) {
		this.firstEmail = firstEmail;
		return this;
	}
	public ContactData withSecondEmail(String secondEmail) {
		this.secondEmail = secondEmail;
		return this;
	}
	public ContactData withBDay(String bDay) {
		this.bDay = bDay;
		return this;
	}
	
	public ContactData withBMonth(String bMonth) {
		this.bMonth = bMonth;
		return this;
	}
	
	public ContactData withBYear(String bYear) {
		this.bYear = bYear;
		return this;
	}

	public ContactData withGroupLink(String groupLink) {
		this.groupLinkage = groupLink;
		return this;
	}
	
	public ContactData withSecondAddress(String secondAddress) {
		this.secondAddress = secondAddress;
		return this;
	}

	public ContactData withSecondPhone(String secondPhone) {
		this.secondPhone = secondPhone;
		return this;
	}	
	
	
	public String getContactFirstname() {
		return firstName;
	}

	public String getContactLastname() {
		return lastName;
	}

	public String getContactFirstaddr() {
		return firstAddress;
	}
	
	public String getContactHomephone() {
		return homePhone;
	}

	public String getContactMobile() {
		return mobilePhone;
	}

	public String getContactWorkphone() {
		return workPhone;
	}
	public String getContactFirstemail() {
		return firstEmail;
	}

	public String getGroupHeader() {
		return secondEmail;
	}

	public String getContactBday() {
		return bDay;
	}
	
	public String getContactBmonth() {
		return bMonth;
	}

	public String getContactByear() {
		return bYear;
	}

	public String getContactGroup() {
		return groupLinkage;
	}
	
	public String getContactSecondaddr() {
		return secondAddress;
	}

	public String getContactSecondphone() {
		return secondPhone;
	}
}